﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Microsoft.Win32;
using System.Runtime.InteropServices;
using System.Windows;

namespace ClipPlayer
{
    class CClientAreaSize
    {
        [DllImport("user32.dll")]
        static extern bool GetClientRect(IntPtr hWnd, out RECT lpRect);

        [Serializable, StructLayout(LayoutKind.Sequential)]
        public struct RECT
        {
            public int Left;
            public int Top;
            public int Right;
            public int Bottom;
        }

        public static int GetClientWidth(System.Windows.Window w)
        {
            RECT result = new RECT();
            GetClientRect(new  System.Windows.Interop.WindowInteropHelper(w).Handle, out result);
            return result.Right - result.Left;
        }


    }//class
}//namespace
